<template>
	<el-image :previewSrcList="previewSrcList" preview-teleported hideOnClickModal :src="path" :fit="fit">
		<slot name="error"></slot>
		<slot name="placeholder"></slot>
	</el-image>
</template>

<script setup>
import { computed } from "vue"

const props = defineProps({
	src: {
		type: String,
		default: "",
	},
	noPreview: {
		type: Boolean,
		default: false,
	},
	fit: {
		type: String,
		default: "cover",
	},
})

const previewSrcList = computed(() => (props.noPreview ? void 0 : [props.src]))
const path = computed(() => props.src || "")
</script>
<script>
export default {
	name: "v-image",
}
</script>

<style lang="scss" scoped></style>
